<template>
    <div class="acc">
        <el-breadcrumb separator="/" style="margin-bottom:20px;">
            <el-breadcrumb-item :to="{ path: '/' }">
                <i class="el-icon-setting" style="margin-right:4px;"></i>首页</el-breadcrumb-item>
            <el-breadcrumb-item>集团酒店添加</el-breadcrumb-item>
        </el-breadcrumb>
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" style="width:500px">
            <el-form-item label="集团名称" prop="hotel_name">
                <el-input v-model="ruleForm.hotel_name"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
export default {
    data() {
      return {
        ruleForm: {
          hotel_name: '',
          hotel_type:1,
          hotel_id:0
        },
        rules: {
          hotel_name: [
            { required: true, message: '请输入集团名称', trigger: 'blur' }
          ]
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
             this.ruleForm.hotel_id = +new Date();
             this.$http.get(this.ajaxUrl() + "/index/groupAdd", {
                params: this.ruleForm
            }).then((res) => {
                if (res.data.sort === 0) {
                    this.$message.error('修改失败！');
                } else if (res.data.sort === 1) {
                    this.$message('修改成功');
                }
            })
          } else {
            ('error submit!!');
            return false;
          }
        });
      }
    }
}
</script>
<style>
.acc {
    width: 800px;
}

.nav-a {
    color: #fff!important;
}
</style>


